<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/base.jsp"%>
<%@ include file="/module/taglibs.jsp"%>
<%@ include file="/module/nocache.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>党员管理</title>
<%@ include file="/module/js.jsp"%>
</head>
<body>
	<form action="#" name="Form" id="Form" method="post">
		<input type="hidden" name="idList" id="idList" /> <input type="hidden"
			id="bodyData" name="bodyData" value="" />
		<table cellpadding="1" cellspacing="1" border="0">
		<c:if test="${_login_user_type==2}">
			<tr>
				<td>
				  <kl:permission permisstionList="${permisstionList}"
                    currentUser="${_login_console_user}"
                    currentCatalogId="<%=CatalogUtils.getCatalogId(\"ZHDJ_KHGL_XFZS\")%>" key="add">
				<input type="button" id="btnaddGarde" autocomplete="off"
					value="添加" class="inputButton" />
				  </kl:permission>
				</td>
				<td>
				 <kl:permission permisstionList="${permisstionList}"
                    currentUser="${_login_console_user}"
                    currentCatalogId="<%=CatalogUtils.getCatalogId(\"ZHDJ_KHGL_XFZS\")%>" key="delete"> 
				<input type="button" id="btnDelete" value="删除"
					class="inputButton" />
				 </kl:permission>
				</td>
				<td><input type="button" id="btnreturn" value="返回"
					class="inputButton" /></td>	
			</tr>
		</c:if>
		</table>
		<table id="dg"  style="width: 100%;"
			data-options="pagination:true,collapsible:true,url:'${basePath}/dyxfzs/getgradeListData',method:'post',remoteSort:true">
			<thead>
				<tr>
					<th
						data-options="field:'itemId',checkbox:true,width:500,align:'center'"></th>
					<th
						data-options="field:'itemName',sortable:true,nowrap:true,width:645,align:'center'">项目名称</th>
					<th
						data-options="field:'itemScore',sortable:true,nowrap:true,width:608,align:'center'">分值</th>
				</tr>
			</thead>
		</table>
	</form>

	<div id="addGardeDiv"
		style="display: none; text-align: center; padding-top: 35px; height: 300px;">
		<div style="margin-top: 0px;">
			<form action="${basePath}/dyxfzs/insertgarde" method="post">
				<table cellpadding="0" cellspacing="0" border="0" align="center">
					<tr>
						<td class="table-titleTD"><font style="color: red;">*</font>项目名称:</td>
						<td class="table-contentTD">
						<input type="text" id="itemName" name="itemName" value="" 
						maxlength="100" placeholder="项目名称"
							class="inputText required" />&nbsp&nbsp;</td>
					</tr>
					<tr>
						<td class="table-titleTD"><font style="color: red;">*</font>项目分值:</td>
						<td class="table-contentTD">
						<input type="number" id="itemScore"  name="itemScore" class="inputText"
						placeholder="（只能输入整数）" maxlength="100" 
							/>		
					    </td>
					</tr>
				</table>
				<table border="0" cellpadding="60px" cellspacing="0" border="0" align="center">
					<tr>
						<td><input type="submit" id="btnGardeSave" class="inputButton"
							style="text-align: center;" value="保存" /></td>
					</tr>
				</table>
			</form>
		</div>
	</div>
	<script type="text/javascript">
		$(document)
				.ready(
						function() {
							 var ipt = $('#itemScore');
							    ipt.on('keyup',function(){
							        if(! /^\d+(-)+$/.test(this.value)){
							            this.value='';
							        }
							    })
							
							$('#dg').datagrid({
								rowStyler: function(index,row){
								},
								onLoadSuccess : function(data) {//加载完毕后获取所有的checkbox遍历
									if (data.rows.length > 0) {
									}
								},
						});

			/* 返回 */
			$("#btnreturn").click(function() {
	 			   window.location.href='${basePath}/dyxfzs/list';
	 		});
			// 删除
			$('#btnDelete')
					.click(
							function() {
								$("#idList").val("");
								var count = 0;
								var idList = new Array();
								var sels = $("#dg").datagrid(
										"getSelections");
								for ( var i in sels) {
									idList.push(sels[i].itemId);
									count++;
								}
								if (count == 0) {
									layer.alert(
											"您至少选择一条删除记录信息", {
												icon : 3
											});
									return false;
								} else {
									layer
									.confirm(
											"您是否删除当前选中数据信息",
											{
												icon : 3,
												title : '提示',
												skin : 'layer-ext-moon'
											},
											function(
													index) {
												$(
														"#idList")
														.val(
																idList);
												document.Form.action = "${basePath}/dyxfzs/deletegrade";
												document.Form
														.submit();
											},
											function(
													index) {
												layer
														.close(index);
											});
								}
							});
						});

		$("#btnaddGarde").click(function() {
			$('#addGardeDiv').dialog('open');
		});
		if ("${msg}" != "") {
			layer.alert("${msg}", {
				icon : 6
			});
		}
		//添加打分项	
		$("#addGardeDiv")
			.dialog(
					{
						bgiframe : true,
						modal : true,
						draggable : false,
						resizable : false,
						title : '添加打分项目',
						autoOpen : false,
						width : 400,
						height : 300,
					});
		
	</script>
</body>
</html>
